package com.winter.Controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.winter.model.IenterpriseFinancing;
import com.winter.service.IenterpriseFinancingService;
import com.winter.util.Result;

@RestController
@RequestMapping("/ienterprise")
public class IenterpriseFinancingController {

    @Resource
    public IenterpriseFinancingService ienterpriseFinancingService;

    /**
     * 筛选债券以及资金平台列表信息
     *
     * @return list
     */
    @GetMapping("/ienterList")
    public Result getIenterList(Integer pageNumber, Integer pageSize, String proStatus, String dcFinancingType, String finDeadline, String expectAnnualYear, String finAmoutn, String proRating, String userNo, String key) {
        return ienterpriseFinancingService.getIenterList(pageNumber, pageSize, proStatus, dcFinancingType, finDeadline, expectAnnualYear, finAmoutn, proRating, userNo, key);
    }

    /**
     * 根据Id查询 发布的资金平台信息
     */
    @GetMapping("/queryIenterId")
    public Result queryIenterId(Long id,String userNo) {
        return ienterpriseFinancingService.getIenterBean(id,userNo);
    }

    /**
     * 新增资金平台信息
     *
     * @return int
     */
    @PostMapping("/insertIenter")
    public Result insertIenter(@RequestBody IenterpriseFinancing ien) {
        return ienterpriseFinancingService.insertIenter(ien);
    }

    /**
     * 修改资金平台债券信息
     *
     * @return int
     */
    @PostMapping("/updateIenter")
    public Result updateIenter(@RequestBody IenterpriseFinancing ien) {
        return ienterpriseFinancingService.updateIenter(ien);
    }
}
